package cn.kgc.service.impl;

import cn.kgc.mapper.EmployeeInfMapper;
import cn.kgc.pojo.EmployeeInf;
import cn.kgc.service.EmployeeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("employeeService")
public class EmployeeServiceimpl implements EmployeeService {

    @Resource
    EmployeeInfMapper employeeInfMapper;

    @Override
    public int getCount(String name, String cardId, String phone,Integer deptId,Integer jobId,Integer sex) {
        return employeeInfMapper.getCount(name,cardId,phone,deptId,jobId,sex);
    }
    @Override
    public List<EmployeeInf> getEmployeeInfByPage(Integer cruuentPageNo, Integer pageSize, String name, String cardId, String phone,
                                                  Integer deptId,Integer jobId,Integer sex) {
        Integer pageNo = (cruuentPageNo-1)*pageSize;

        return employeeInfMapper.getEmployeeInfByPage(pageNo,pageSize,name,cardId,phone,deptId,jobId,sex);
    }

    @Override
    public EmployeeInf getEmployeeInfById(Integer id) {
        return employeeInfMapper.getEmployeeInfById(id);
    }

    @Override
    public boolean updateEmployeeInf(EmployeeInf employeeInf) {
        int conut = employeeInfMapper.updateEmployeeInf(employeeInf);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean addEmployeeInf(EmployeeInf employeeInf) {
        int conut = employeeInfMapper.addEmployeeInf(employeeInf);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean delId(Integer id) {
        int conut = employeeInfMapper.delId(id);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public EmployeeInf getEmployeeInfName(String name) {
        return employeeInfMapper.getEmployeeInfName(name);
    }
}
